package approve.action;

import java.util.List;

import model.pojo.Employee;
import resource.pojo.Approvedoc;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View.OnClickListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import approval.dao.ApproveDocumentDAO;

public class My_App_MeetingDocumentSendding extends Activity {
	String database = "admin";
	public String getDatabase() {
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			database = extras.getString("database");
		}
		return database;
	}
	public String getLang() {
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			lang = extras.getString("lang");
		}
		return lang;
	}

	String lang = "EN";
	Approvedoc AppDoc = null;
	Employee emp=null;
	ListView list;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_app_meetingdocument);
		getDatabase();
		emp=(Employee) getIntent().getExtras().get("em");
		list=(ListView) findViewById(R.id.lst_mymeetingdocument);
		list.setAdapter(new ArrayAdapter<Approvedoc>(this, android.R.layout.simple_list_item_1,getListAppovedDocument()));
		list.setOnItemClickListener(viewDocument);
	}
	private OnItemClickListener viewDocument=new OnItemClickListener() {
		public void onItemClick(android.widget.AdapterView<?> lstAppDoc, android.view.View arg1, int arg2, long arg3) {
			Approvedoc AppDoc=(Approvedoc) lstAppDoc.getItemAtPosition(arg2);
			Intent intent =new Intent(My_App_MeetingDocumentSendding.this,My_ViewForm11.class);
			intent.putExtra("AppDoc", AppDoc);
			intent.putExtras(getIntent().getExtras());
			startActivityForResult(intent, 0);	
		};
	};
	public List<Approvedoc> getListAppovedDocument() {
		return ApproveDocumentDAO.listStorageMeeting(emp.getIdemployee(), getDatabase());
	}

}
